package com.zhonggong.sixteen;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.FileNotFoundException;
import java.io.IOException;

public class TwoTest {
	
	protected static void remove(String ch) throws IOException
	{
	    BufferedReader br = null;
	    FileWriter fw= null;
	    String s = null;	
	   try
	   { 
	     br = new BufferedReader(new FileReader("D:\\1.txt"));
	     fw = new FileWriter("D:\\2.txt");

	    while(null != (s = br.readLine())){
	    	s = s.replaceAll(ch,"");	
	    	System.out.println(s);
	    	s= s+"\r\n";
	    	fw.write(s);
	   	}
	    fw.close();
	    br.close();
	    s = null;
	   }
	catch(FileNotFoundException e)
	{
		System.out.println("未找到文件\n");
	}
	

}
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		remove("John");
	}

}
